In a hard disk drive, a floppy (trademark) disk drive, CD-ROM/CD-R/CD-RW disc drives, and so forth, which are external storing apparatuses for personal computers, data is processed in the unit of a sector. For example, the size of one sector is 2 Kbytes (2048 bytes). To protect the copyright of contents, contents data is encrypted and recorded. To encrypt contents data in the unit of a sector, each sector requires an encryption control bit. In the CBC (Chaining Block Ciphering) mode, an IV (Initial Vector: encryption initial value) is required.
As a transmitting or recording format for multimedia contents data, the MPEG (Moving Picture Experts Group) is known. FIG. 1A shows a data structure of a program stream corresponding to the MPEG2 system. One program starts with a pack header and ends with an end code. Generally, a pack is composed of a plurality of packets. A system header is added to the top pack. The system header is optionally added to the later packets. A pack header is added at the beginning of each pack.
As shown in FIG. 1A, the pack header is composed of a pack start code (32 bits), an identification code (2 bits), an SCR (System Clock Reference: system time reference value) (42+4 bits), a multiplexing rate (22+2 bits) that represents the bit rate of the stream, a stuffing length (3+8 bits), and a stuffing byte (8×M bits). The stuffing byte is dummy data used to keep for example the packet data length constant. Thus, the stuffing byte does not have meaningful information.
FIG. 1B shows the structure of a packet. At the beginning is a packet start code (32 bits) placed. The packet start code is composed of a beginning start code and a stream ID (8 bits). The packet start code is followed by a packet length (16 bits) that represents the data length of a packet. A control code (2 bits) is “01” in the MPEG2 system. The first two bits of a flag and control (14 bits) are used for a PES (Packetized Elementary Stream) scramble control. A PES header length (8 bits) represents the header length. Corresponding to the flag and control, conditional coding items are placed. The conditional coding items contains a PTS (Presentation Time Stamp) (33+7 bits), a DTS (Decoding Time Stamp) (33+7 bits), and data of other codes. In addition, a stuffing byte (8×M bits) is added. The stuffing byte is followed by packet data (8×N bits).
FIG. 2 shows a data structure for 2 Kbytes in the MPEG2 system to be merged with the data format of a conventional application with a sector length of 2 Kbytes (2048 bytes) (hereinafter sometimes referred to as conventional data format). As shown in FIG. 2, one pack is composed of one packet. The size of one pack is 2 Kbytes. Thus, one pack is equivalent to one sector of the conventional format. At the top of one pack is a pack header (14 bytes) placed. The pack header is followed by a PES header (14 bytes), a stream header (4 bytes), and user data (2016 bytes) in the order. When the user data is divided in the unit of eight bytes, the user data (or packet) is composed of D1 to D252. The user data is for example audio data that has been compression-encoded and encrypted. Thus, the data structure shown in FIG. 2 satisfies the MPEG2 system coding rule.
Although the pack header shown in FIG. 2 is the same as that shown in FIG. 1A, since the pack header shown in FIG. 2 does not contain a stuffing byte, the length thereof is 14 bytes. In other words, the pack header is composed of a pack start code (32 bits), a control code (2 bits), an SCR (42+4 bits), a multiplexing rate (22+2 bits) that represents the bit rate of the stream, and a stuffing length (3+5 bits), which is a total of 112 bits (=14 bytes). The stuffing byte is not added so as to prevent the stuffing byte from varying the position of the scramble control bit.
Although the PES header shown in FIG. 2 is the same as that shown in FIG. 1B, the PES header shown in FIG. 2 is composed of a packet start code (32 bits), a packet length (16 bits), a two-bit control code, a flag and control (14 bits), a PES header length (8 bits), and a PTS (33+7 bits), which is a total of 112 bits (=14 bytes).
The stream header (4 bytes) contains information that represents audio coding method (linear PCM, MP3 (MPEG1 Audio Layer III), AAC (Advanced Audio Coding), ATRAC3 (Adapive Transform Acoustic Coding 3, or the like), a bit rate (64 Kbps or the like), the number of channels (monaural, stereo, 5.1 channels, or the like), and so forth.
Bit numbers are added to 32 bytes (=256 bytes) of the pack header, the PES header, and the stream header to define bit positions. When the top bit is bit 0, the pack header is from bit 0 to bit 111; the PES header is from bit 112 to bit 223; and the stream header is from bit 223 to bit 255. In the PES header, the scramble control bits of the flag and control are from bit 162 to bit 163. The scramble control bits have been defined as “00”=non-scrambled; “01”=scrambled; and “10” and “11”=reserved (not defined).
The two-bit control code of bit 32 and bit 33 of the pack header is “00” has been defined as “00”=MPEG1 system; and “01”=MPEG2 system. In the MPEG1 system, no scramble control bits are used. As the IV necessary for encryption, the SCR of the pack header, the PTS of the PES header, or the like is used.
FIG. 3A shows the data structure for one sector in a conventional data format (that means the data format of a conventional application other than the MPEG systems). Assuming that encrypting is performed with the IV in the CBC (Chaining Block Ciphering) mode (normally mostly, a process in the unit of eight bytes), the top eight bytes contain data of the scramble control, the IV, and so forth. For example, four bytes are used as the IV. 2040 bytes of which the sector header is excluded form one sector are user data. In other words, the user data is composed of 2040 bytes. When the user data is divided in the unit of eight bytes, it contains data D1 to D255.
It is preferred to allow for example a personal computer, an optical disc drive, and application software (hereinafter referred to as drive and so forth) to deal with both the data format corresponding to the forgoing MPEG2 system and the conventional data format shown in FIG. 3A. For example, conventional application data is dealt with the conventional data format, whereas audio and video data are dealt with data corresponding to the MPEG2 system. When audio and video data are in a data format corresponding to the MPEG2 system, the audio data and the video data can be multiplexed with data of the conventional application. For example, sound and a song text image can be recorded at a time. With the PTS, which is a time stamp, even if data has been compression-encoded with a variable length code, the data can be accessed at high speed.
When two different data formats are used, the drive and so forth may identify the data formats and selectively access data thereof. In this method, however, it is difficult for the drive and so forth to identify the two different formats. To judge whether data has been encrypted in the unit of a sector, the drive and so forth should look up bits at different positions corresponding to the MPEG2 system and the conventional data format. Thus, it is difficult for the drive and so forth to judge whether data has been encrypted in the unit of a sector.
As another method, two different data formats are merged. In this method, such a problem about the selection of the formats does not arise. FIG. 3B shows the data structure in the case that the conventional data format is fit to the MPEG2 system. In the MPEG2 system, the top 32 bytes are a pack header, a PES header, and a stream header as shown in FIG. 2A. Information (scramble control bits and IV) contained in the sector header (eight byes) in the conventional data format can be composed of 32 bytes. However, although the conventional data format needs a header of only eight bytes, the format corresponding to the MPEG2 system needs a header of 32 bytes. Thus, (32−8=24 bytes) are wasted. In other words, the user data of one sector is decreased from 2040 bytes to 2016 bytes. In addition, to fix the positions of the scramble control bits in the MPEG2 system, the stuffing byte cannot be used.
On the other hand, when the MPEG2 system is fit to the conventional data format, as shown in FIG. 3C, a header of eight bytes is added at the beginning of one sector in the data format of the MPEG2 system. As a result, no problem will arise in applications corresponding to other than the MPEG2 system format. However, in applications corresponding to the MPEG2 system, the top eight bytes will be wasted.
Therefore, an object of the present invention is to provide a data outputting method, a recording method and apparatus, a reproducing method and apparatus, and a data transmitting method and receiving method that prevent data from being wasted and user data from being decreased and that allow data structures of different systems to be merged.